@IsTest
public with sharing class MyListTest {
    
    @IsTest
    static void testIterator(){

        Student stu1 = new Student('张三');
        Student stu2 = new Student('李四');
        Student stu3 = new Student('王五');

        List<Student> stuList = new List<Student>{stu1, stu2, stu3};

        MyList myList = new MyList(stuList);

        Test.startTest();
        //System.runAs(contextuser){
            
        Iterator<Student> it = myList.iterator();
        while(it.hasNext()) {
            System.debug(it.next().sname);
        }
            
        //}
        Test.stopTest();
        
    }

}